package com.example.eos.controller;

import com.example.eos.bean.ReturnInfo;
import com.example.eos.service.UserLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class UserLabelController {

    private UserLabelService userLabelService;

    @Autowired
    public UserLabelController(UserLabelService userLabelService){
        this.userLabelService = userLabelService;
    }

    //查询用户的标签
    @RequestMapping(value = "/userlabel/{userid}",method = RequestMethod.GET)
    public ReturnInfo findUserLabel(@PathVariable String userid){
        return userLabelService.findUserLabel(userid);
    }

    //用户添加标签
    @RequestMapping(value = "/userlabel/label/{labelid}",method = RequestMethod.POST)
    public ReturnInfo addUserLabel(@PathVariable String labelid){
        return userLabelService.addUserLabel(labelid);
    }

    //用户删除标签
    @RequestMapping(value = "/userlabel/label/{labelid}",method = RequestMethod.DELETE)
    public ReturnInfo deleteUserLabel(@PathVariable String labelid){
        return userLabelService.deleteUserLabel(labelid);
    }

}
